<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>到账登记</title>

    <meta name="description" content="Source code generated using layoutit.com">
    <meta name="author" content="LayoutIt!">

    <link href="/static/css/bootstrap.min.css" rel="stylesheet">
    <link href="/static/css/style.css" rel="stylesheet">
    <link href="/static/fonts/line-icons.css" rel="stylesheet">
    <link href="/static/plugins/datatables/dataTables.bootstrap4.min.css" rel="stylesheet">
    <link href="/static/plugins/datatables/buttons.bootstrap4.min.css" rel="stylesheet" type="text/css">
    <link href="/static/plugins/datatables/responsive.bootstrap4.min.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" type="text/css" href="/static/css/main.css">
    <link rel="stylesheet" type="text/css" href="/static/css/responsive.css">


</head>
<body>
<div class="app header-default side-nav-dark">
    <div class="layout">
        <!--顶部栏-->
        <div th:replace="~{/topbar::topbar}">
        </div>
        <!--侧边栏-->
        <div th:replace="~{/sidebar::sidebar}">
        </div>
        <!--主体部分-->
        <div class="page-container">
            <div class="main-content">
                <div class="container-fluid">
                    <div class="breadcrumb-wrapper row">
                        <div class="col-12 col-lg-3 col-md-6">
                            <h4 class="page-title">经费登记项目列表</h4>
                        </div>
                    </div>
                </div>
                <div class="container-fluid">
                    <div class="row">
                        <div class="col-md-12">
                            <span class="badge badge-default">经费登记项目列表</span>
                            <br>
                            <br>
                            <table id="datatable" class="table table-bordered">
                                <thead>
                                <tr>
                                    <th>
                                        项目名称
                                    </th>
                                    <th>
                                        负责人
                                    </th>
                                    <th>
                                        到款日期
                                    </th>
                                    <th>
                                        来款单位
                                    </th>
                                    <th>
                                        到款金额
                                    </th>
                                    <th>
                                        到账金额
                                    </th>
                                    <th>
                                        经办人
                                    </th>
                                    <th>
                                        操作
                                    </th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr th:each="project:${list}">
                                    <form th:id="${project.fid}" th:onsubmit="return f( ${project.fid})">
                                        <td th:text="${project.name}" th:id="${project.fid}+'name'">
                                            新化学材料的研究
                                        </td>
                                        <td th:text="${project.leader}">
                                            张三
                                        </td>
                                        <td th:text="${project.fdate}">
                                            2021-11-07
                                        </td>
                                        <td th:text="${project.fpaymentunit}">
                                            材料科学与工程学院
                                        </td>
                                        <td th:text="${project.fmoney}">
                                            8.0万元
                                        </td>
                                        <td>
                                            <input type="text" name="money" style="width:100px; height:30px;">
                                        </td>
                                        <td>
                                            <input type="text" name="operator" style="width:100px; height:30px;">
                                        </td>
                                        <td>
                                            <input type="hidden" name="paymentUnit" th:value="${project.fpaymentunit}">
                                            <input type="hidden" name="pId" th:value="${project.id}" id="pid">
                                            <input type="hidden" name="fId" th:value="${project.fid}">
                                            <button type="submit" class="btn btn-secondary">到账登记</button>
                                        </td>
                                    </form>
                                </tr>
                                </tbody>
                            </table>
                            <div class="modal fade" id="addGrid" tabindex="-1" role="dialog" aria-labelledby="Label"
                                 aria-hidden="true">
                                <div class="modal-dialog" style="width:420px;" role="document">
                                    <div class="modal-content">
                                        <div class="modal-header px-4">
                                            <h5 class="modal-title" id="Label">Add Somthing to Grid</h5>
                                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                <span class="material-icons ">close</span>
                                            </button>
                                        </div>
                                        <div class="modal-body p-4">

                                            <form onsubmit="return f()">
                                                <div class="form-group">
                                                    <label for="Input4">负责人</label>
                                                    <input type="text" class="form-control" id="Input4">
                                                </div>
                                                <div class="form-group">
                                                    <label for="Input5">到款金额</label>
                                                    <input type="text" class="form-control" id="Input5">
                                                </div>
                                                <div class="form-group">
                                                    <label for="Input6">到账金额</label>
                                                    <input type="text" class="form-control" id="Input6">
                                                </div>
                                                <div class="modal-footer px-4">
                                                    <button type="button" class="btn btn-secondary"
                                                            data-dismiss="modal">关闭
                                                    </button>
                                                    <button type="submit" class="btn btn-primary">确认</button>
                                                </div>
                                            </form>
                                        </div>

                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <footer class="content-footer">
                    <div th:replace="~{/footer::footer}"></div>
                </footer>
            </div>
        </div>
    </div>

</div>

<script src="/static/js/jquery.min.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
<script src="/static/js/scripts.js"></script>
<script src="/static/js/popper.min.js"></script>
<script src="/static/js/jquery.app.js"></script>
<script src="/static/js/main.js"></script>
<script src="/static/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="/static/plugins/datatables/dataTables.bootstrap4.min.js"></script>
<script src="/static/plugins/datatables/dataTables.buttons.min.js"></script>
<script src="/static/plugins/datatables/buttons.bootstrap4.min.js"></script>
<script src="/static/plugins/datatables/jszip.min.js"></script>
<script src="/static/plugins/datatables/pdfmake.min.js"></script>
<script src="/static/plugins/datatables/vfs_fonts.js"></script>
<script src="/static/plugins/datatables/buttons.html5.min.js"></script>
<script src="/static/plugins/datatables/buttons.print.min.js"></script>
<script src="/static/plugins/datatables/buttons.colVis.min.js"></script>
<script src="/static/plugins/datatables/dataTables.responsive.min.js"></script>
<script src="/static/plugins/datatables/responsive.bootstrap4.min.js"></script>
<script src="/static/js/datatables.init.js"></script>

<script type="text/javascript">
    function f(fid) {
        var fidval = '\'#' + fid + '\'';
        var name = '\'#' + fid + 'name\'';
        alert($(name));
        alert(id);
        // var formData = new FormData($(id)[0]);
        $.ajax({
            url: "admin/fund/fund_list",
            type: "post",
            data: JSON.stringify({
                "name": $(name),
                "pId": $('#pid')
            }),
            // processData:false,
            contentType: "application/json",
            dataType: "json",
            success: function (result) {
                if (result && result.success ) {
                    alert("提交成功");
                    window.location.href = "admin/fund/income";
                } else {
                    alert(result.msg);
                }
            }
        });
        return false;
    }
</script>
</body>
</html>